package com.mariusz.managers;

import java.util.ArrayList;
import java.util.List;

import com.mariusz.data.DataContainer;
import com.mariusz.data.rules.EmptyRoomRule;
import com.mariusz.data.rules.EndOfContractRule;
import com.mariusz.data.rules.PaymentExceededRule;
import com.mariusz.data.rules.Rule;

public class RulesManager {

	List<Rule> rules; 
	static RulesManager ruleManager = new RulesManager();
	
	private RulesManager(){
		rules = new ArrayList<Rule>();
		rules.add(new PaymentExceededRule());
		rules.add(new EndOfContractRule());
		rules.add(new EmptyRoomRule());
	}
	public static RulesManager getInstance(){
		return ruleManager;
	}
	
	public List<String> processRules(DataContainer dt){
		List<String> returnList = new ArrayList<String>();
		for(Rule r : rules){
			List<String> messages = r.processMessages(dt);
			returnList.addAll(messages);
		}
		return returnList;
	}
	
}
